
#include <jni.h>
#include <cstdlib>
#include <stdexcept>
#include <string>
#include <sstream>

#include <opencv2/core/core.hpp>
using namespace cv;


extern "C"
jstring
Java_org_fox_fcvandroid_MainAct_stringFromJNI( JNIEnv* env,
                                                  jobject thiz )
{
    Mat K(3,3,DataType<double>::type);
    std::stringstream ss;
    std::string s = "Hello from JNI ! " ;
    ss << s <<  K.cols << " " << K.rows;
    try
    {
        if (std::getenv("NON_EXISTENT_ENVIRONMENT_VARIABLE") == NULL)
            throw std::runtime_error("Hello from JNI (with full C++ support) !");
    }
    catch (std::exception &ex)
    {
        s = ex.what();
    }
//    return env->NewStringUTF(ss.str().c_str());
    return env->NewStringUTF(s.c_str());
}
